home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 25
/
AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso
/
Updates
/
HD-Installer
/
-WHDLoad-
/
WHDLoad_dev
/
patcher1.04.lha
/
Patcher1.04
/
MAKECOMPARATIONTABLE2
next >
Wrap
Text File
|
1997-05-01
|
12KB
|
637 lines
;This program compares two files with the same length and makes a table
;of the differences between them.
;Done by Egon.
INCDIR ASM-ONE:INCLUDE2.0/
INCLUDE LIBRARIES/DOS_LIB.I
INCLUDE LIBRARIES/DOS.I
INCLUDE LIBRARIES/DISKFONT_LIB.I
INCLUDE EXEC/EXEC_LIB.I
INCLUDE EXEC/MEMORY.I
INCLUDE GRAPHICS/GRAPHICS_LIB.I
INCLUDE INTUITION/INTUITION_LIB.I
INCLUDE INTUITION/INTUITION.I
INCDIR ASM-ONE:
SIZETABLE = $2000 ;MAXIMALLY SIZE OF COMPARATIONTABLE (Longwords)
HP ;BRA.S HP
BASEREG DOSBAS,A5
LEA.L DOSBAS(PC),A5
MOVE.L A0,DATABASE(A5)
MOVE.L D0,DATALENGTH(A5)
MOVE.L A7,OSSTACK(A5)
SUBQ.L #1,A0
.1 ADDQ.L #1,A0
CMP.B #$9,(A0)
BEQ.S .1
CMP.B #$20,(A0)
BEQ.S .1
CMP.B #$A,(A0)
BNE.S .10
MOVEQ.L #20,D0
RTS
.10 CMP.B #'?',(A0)
BNE.S .2
MOVE.L (_SYSBASE).W,A6
LEA.L DOSNAM(PC),A1
MOVEQ.L #0,D0
JSR _LVOOpenLibrary(A6) ;DOS öffnen
TST.L D0
BEQ.W ERRGENERAL
MOVE.L D0,DOSBAS(A5) ;Zeiger sichern
MOVE.L DOSBAS(PC),A6
JSR _LVOOUTPUT(A6)
TST.L D0
BEQ.W ERRGENERAL
MOVE.L D0,OUTPUTBAS(A5)
LEA.L HELPSYNTAX(PC),A0
MOVEQ.L #0,D3
MOVE.L A0,D2
.9 TST.B (A0)+
BEQ.S .8
ADDQ.L #1,D3
BRA.S .9
.8 MOVE.L OUTPUTBAS(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOWRITE(A6)
LEA.L $0.W,A0
BRA.W ENDE
.2 LEA.L LOCK1NAM(PC),A1
BSR.W EXAMPARAM
TST.L D3
BNE.S .3
MOVEQ.L #20,D0
RTS
.3 LEA.L LOCK2NAM(PC),A1
BSR.W EXAMPARAM
TST.L D3
BNE.S .4
MOVEQ.L #20,D0
RTS
.4 TST.L D0
BNE.S .6
.5 LEA.L LOCK3NAM(PC),A1
BSR.W EXAMPARAM
TST.L D3
BNE.S .7
.6 ST NOTSAVE(A5)
.7
MAINPRG MOVE.L (_SYSBASE).W,A6
LEA.L DOSNAM(PC),A1
MOVEQ.L #0,D0
JSR _LVOOpenLibrary(A6) ;DOS öffnen
TST.L D0
BEQ.W ERRGENERAL
MOVE.L D0,DOSBAS(A5) ;Zeiger sichern
MOVE.L DOSBAS(PC),A6
JSR _LVOOUTPUT(A6)
TST.L D0
BEQ.W ERRGENERAL
MOVE.L D0,OUTPUTBAS(A5)
LEA.L WRITTEN(PC),A0
MOVEQ.L #0,D3
MOVE.L A0,D2
.3 TST.B (A0)+
BEQ.S .2
ADDQ.L #1,D3
BRA.S .3
.2 MOVE.L OUTPUTBAS(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOWRITE(A6)
LEA.L LOCK1NAM(PC),A1
MOVE.L A1,D1
MOVE.L #MODE_READWRITE,D2
MOVE.L DOSBAS(PC),A6
JSR _LVOLOCK(A6)
TST.L D0
BEQ.W ERRNOTEXIST
MOVE.L D0,PARAM1LOCK(A5)
MOVE.L PARAM1LOCK(PC),D1
MOVE.L #PARAM1INFO,D2
MOVE.L DOSBAS(PC),A6
JSR _LVOEXAMINE(A6)
TST.L D0
BEQ.W ERRNOTEXIST
LEA.L PARAM1INFO,A0
CMP.L #-3,FIB_DIRENTRYTYPE(A0)
BNE.W ERRNOFILE
LEA.L LOCK2NAM(PC),A1
MOVE.L A1,D1
MOVE.L #MODE_READWRITE,D2
MOVE.L DOSBAS(PC),A6
JSR _LVOLOCK(A6)
TST.L D0
BEQ.W ERRNOTEXIST
MOVE.L D0,PARAM2LOCK(A5)
MOVE.L PARAM2LOCK(PC),D1
MOVE.L #PARAM2INFO,D2
MOVE.L DOSBAS(PC),A6
JSR _LVOEXAMINE(A6)
TST.L D0
BEQ.W ERRNOTEXIST
LEA.L PARAM2INFO,A0
CMP.L #-3,FIB_DIRENTRYTYPE(A0)
BNE.W ERRNOFILE
LEA.L PARAM1INFO,A0
MOVE.L FIB_SIZE(A0),D0
LEA.L PARAM2INFO,A0
CMP.L FIB_SIZE(A0),D0
BNE.W ERROTHERLEN
MOVE.L D0,LENGTH(A5)
ADD.L #$7,D0
AND.L #$FFFF8,D0
MOVE.L D0,A2
MOVE.L #MEMF_CLEAR,D1
MOVE.L (_SYSBASE).W,A6
JSR _LVOALLOCMEM(A6)
TST.L D0
BEQ.W ERRNOTENMEM
MOVE.L D0,MEM1BASE(A5)
MOVE.L A2,D0
MOVE.L #MEMF_CLEAR,D1
MOVE.L (_SYSBASE).W,A6
JSR _LVOALLOCMEM(A6)
TST.L D0
BEQ.W ERRNOTENMEM
MOVE.L D0,MEM2BASE(A5)
LEA.L LOCK1NAM(PC),A1
MOVE.L A1,D1
MOVE.L #MODE_OLDFILE,D2
MOVE.L DOSBAS(PC),A6
JSR _LVOOPEN(A6)
TST.L D0
BEQ.W ERROPENFILE
MOVE.L D0,FILHANDLE(A5)
MOVE.L FILHANDLE(PC),D1
MOVE.L MEM1BASE(PC),D2
LEA.L PARAM1INFO,A0
MOVE.L FIB_SIZE(A0),D3
MOVE.L DOSBAS(PC),A6
JSR _LVOREAD(A6)
TST.L D0
BMI.W ERRLOADFILE
BEQ.W ERRLOADFILE
MOVE.L FILHANDLE(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOCLOSE(A6)
CLR.L FILHANDLE(A5)
LEA.L LOCK2NAM(PC),A1
MOVE.L A1,D1
MOVE.L #MODE_OLDFILE,D2
MOVE.L DOSBAS(PC),A6
JSR _LVOOPEN(A6)
TST.L D0
BEQ.W ERROPENFILE
MOVE.L D0,FILHANDLE(A5)
MOVE.L FILHANDLE(PC),D1
MOVE.L MEM2BASE(PC),D2
LEA.L PARAM2INFO,A0
MOVE.L FIB_SIZE(A0),D3
MOVE.L DOSBAS(PC),A6
JSR _LVOREAD(A6)
TST.L D0
BMI.W ERRLOADFILE
BEQ.W ERRLOADFILE
MOVE.L FILHANDLE(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOCLOSE(A6)
CLR.L FILHANDLE(A5)
MOVE.L PARAM1LOCK(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOUNLOCK(A6)
CLR.L PARAM1LOCK(A5)
MOVE.L PARAM2LOCK(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOUNLOCK(A6)
CLR.L PARAM2LOCK(A5)
MOVE.L MEM1BASE(PC),A0 ;FILE1 ORIGINAL
MOVE.L MEM2BASE(PC),A1
BSR.W COMP
CMP.L #-1,D0
BEQ.W ERRTABTOOLONG
CMP.L #4,D0
BEQ.W NODIFF
MOVE.L D0,D4
TST.B NOTSAVE(A5)
BNE.S .1
LEA.L LOCK3NAM(PC),A1
MOVE.L A1,D1
MOVE.L #MODE_NEWFILE,D2
MOVE.L DOSBAS(PC),A6
JSR _LVOOPEN(A6)
TST.L D0
BEQ.W ERRSAVEFILE
MOVE.L D0,FILHANDLE(A5)
MOVE.L FILHANDLE(PC),D1
LEA.L COMPTAB,A0
MOVE.L A0,D2
MOVE.L D4,D3
MOVE.L DOSBAS(PC),A6
JSR _LVOWRITE(A6)
TST.L D0
BMI.W ERRSAVEFILE
BEQ.W ERRSAVEFILE
MOVE.L FILHANDLE(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOCLOSE(A6)
.1 CLR.L FILHANDLE(A5)
ALL_OK LEA.L NROK(PC),A0
MOVE.L NUMBER(PC),D0
SWAP D0
BSR.S NEXTNUMBER
BSR.S NEXTNUMBER
BSR.S NEXTNUMBER
BSR.S NEXTNUMBER
LEA.L OKDISP(PC),A0
BRA.S ENDE
NEXTNUMBER CLR.W D0
ROL.L #4,D0
MOVE.B .NR(PC,D0.W),D0
MOVE.B D0,(A0)+
RTS
.NR DC.B '0123456789ABCDEF'
EVEN
NODIFF LEA.L NODIFFDISP(PC),A0
ENDE MOVEQ.L #0,D0
BRA.S ENDE1
ERRGENERAL LEA.L $0.W,A0
BRA.S ERR
ERRSAVEFILE LEA.L ERRSAVEDISP(PC),A0
BRA.S ERR
ERRNOTEXIST LEA.L NOTEXISTDISP(PC),A0
BRA.S ERR
ERRNOFILE LEA.L NOFILEDISP(PC),A0
BRA.S ERR
ERROTHERLEN LEA.L OTHERLENDISP(PC),A0
BRA.S ERR
ERRNOTENMEM LEA.L NOTENMEMDISP(PC),A0
BRA.S ERR
ERROPENFILE LEA.L ERROPENDISP(PC),A0
BRA.S ERR
ERRLOADFILE LEA.L ERRLOADDISP(PC),A0
BRA.S ERR
ERRTABTOOLONG MOVE.L MEM1BASE(PC),A0
MOVE.L MEM2BASE(PC),A1
MOVEQ.L #0,D0
MOVEQ.L #0,D1
.2 CMPM.B (A0)+,(A1)+
BEQ.S .1
ADDQ.L #1,D1
.1 ADDQ.L #1,D0
CMP.L LENGTH(PC),D0
BLO.S .2
MOVE.L D1,D0
LEA.L NRBIG(PC),A0
BSR.S NEXTNUMBER
BSR.S NEXTNUMBER
BSR.S NEXTNUMBER
BSR.S NEXTNUMBER
MOVE.L D1,D0
SWAP D0
BSR.W NEXTNUMBER
BSR.W NEXTNUMBER
BSR.W NEXTNUMBER
BSR.W NEXTNUMBER
LEA.L NOTSAVEDISP(PC),A0
ERR MOVE.L OSSTACK(PC),A7
MOVEQ.L #20,D0
ENDE1
MOVE.L D0,-(A7)
CMP.L #0,A0
BEQ.S .1
MOVEQ.L #0,D3
MOVE.L A0,D2
.3 TST.B (A0)+
BEQ.S .2
ADDQ.L #1,D3
BRA.S .3
.2 MOVE.L OUTPUTBAS(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOWRITE(A6)
.1 TST.L FILHANDLE(A5)
BEQ.S .9
MOVE.L FILHANDLE(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOCLOSE(A6)
.9 TST.L PARAM1LOCK(A5)
BEQ.S .5
MOVE.L PARAM1LOCK(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOUNLOCK(A6)
.5 TST.L PARAM2LOCK(A5)
BEQ.S .4
MOVE.L PARAM2LOCK(PC),D1
MOVE.L DOSBAS(PC),A6
JSR _LVOUNLOCK(A6)
.4 MOVE.L LENGTH(PC),D0
ADD.L #$7,D0
AND.L #$FFFF8,D0
MOVE.L D0,A2
TST.L MEM1BASE(A5)
BEQ.S .8
MOVE.L MEM1BASE(PC),A1
MOVE.L (_SYSBASE).W,A6
JSR _LVOFREEMEM(A6)
.8 TST.L MEM2BASE(A5)
BEQ.S .7
MOVE.L A2,D0
MOVE.L MEM2BASE(PC),A1
MOVE.L (_SYSBASE).W,A6
JSR _LVOFREEMEM(A6)
.7 TST.L DOSBAS(A5)
BEQ.S .6
MOVE.L (_SYSBASE).W,A6
MOVE.L DOSBAS(PC),A1
JSR _LVOCLOSELIBRARY(A6) ;DOS-Lib schliessen
.6 MOVE.L (A7)+,D0
RTS
;----------------------------------------------------------------------------
EXAMPARAM MOVEQ.L #0,D3
SUBQ.L #1,A0
.4 ADDQ.L #1,A0
CMP.B #$9,(A0)
BEQ.S .4
CMP.B #$20,(A0)
BEQ.S .4
CMP.B #$A,(A0)
BEQ.S .3
MOVEQ.L #0,D2
CMP.B #'"',(A0)
BNE.S .6
ST D2
ADDQ.L #1,A0
.6
.1 MOVE.B (A0)+,D1
CMP.B #$9,D1
BEQ.S .2
CMP.B #$20,D1
BEQ.S .2
CMP.B #$A,D1
BEQ.S .3
CMP.B #'"',D1
BEQ.S .5
MOVE.B D1,(A1)+
ADDQ.L #1,D3
BRA.S .1
.2 TST.B D2
BEQ.S .7
MOVE.B D1,(A1)+
ADDQ.L #1,D3
BRA.S .1
.5
.7 MOVE.B #$0,(A1)+
MOVEQ.L #0,D0
RTS
.3 MOVE.B #$0,(A1)+
MOVEQ.L #-1,D0
RTS
*******************************************************************************
;A0: ORGPRG ;ORIGINAL PROGRAM
;A1: MODPRG ;MODIFIED PROGRAM
;THE PROGRAM GIVES BACK THE LENGTH OF THE COMPARATION TABLE IN D0
;IF THE TABLE DEFINED IS NOT BIG ENOUGH, #$FFFFFFFF IS IN D0
;THE PROGRAM USES THE REGISTERS D0,D1 AND A0,A1,A2,A3
COMP CLR.L NUMBER
LEA.L COMPTAB,A2
MOVE.W #SIZETABLE+$40-1,D0
.7 CLR.L (A2)+
DBF D0,.7
LEA.L COMPTAB,A2
CLR.B CMPCOUNT
MOVEQ.L #0,D0
.2 CMPM.B (A0)+,(A1)+
BEQ.S .1
ADD.L #1,NUMBER
ADD.B #1,CMPCOUNT
CMP.B #1,CMPCOUNT
BNE.S .4
OR.L D0,(A2)+
MOVE.L A2,A3 ;A3 POINTS AT THE LOCATION WHERE LATER THE
;LENGTH OF THE ACTUAL STRING IS
.4 CMP.B #2,CMPCOUNT
BNE.S .6
OR.B #$80,-3(A3)
MOVE.B -1(A2),(A2)+
.6 MOVE.B -1(A1),(A2)+ ;WITH FILES, GET THE BYTE FROM THE